﻿@{
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
    ViewBag.Title = "LiShiJieSuanRecords";

}
<style type="text/css">
    tr {
        height: 30px;
        line-height: 30px;
    }

    td {
        padding-left: 20px;
        padding-right: 20px;
    }

    th {
        padding-left: 20px;
        padding-right: 20px;
    }

    .kuai {
        margin-bottom: 20px;
    }
</style>
<div style="padding:40px;" id="table001">    
</div>
<script type="text/javascript">
    $(function () {
        $.ajax({
            type: "get",
            url: "/Consume/OldJiSuanRecords",
            success: function (data) {
                var object = [];
                var dataObject = $.parseJSON(data);
                if (dataObject.length==0) {
                    $("#table001").html("<h1>暂无往期结算结果</h1>");
                    return;
                }
                for (var i = 0; i < dataObject.length; i++) {
                    var item = dataObject[i];
                    var createTime = item.createTime.replace('T',' ');
                    object.push("<div class=\"kuai\">")
                    object.push("<div style=\"margin-bottom:5px;\">执行时间：" + createTime + "</div>");
                    object.push("<table border=\"1\" style=\"border-collapse:collapse;\">");
                    object.push("<tr>");
                    object.push("<th>消费类型名称</th>");
                    object.push("<th>付费人 </th>");
                    object.push("<th>总共支付金额</th>");
                    object.push("<th>参与人数</th>");
                    object.push("<th>平均消费 </th>");
                    object.push("<th>个人消费 </th>");
                    object.push("</tr>");
                    var records = $.parseJSON(item.result)
                    for (var j = 0; j < records.length; j++) {
                        var rowsRecords = records[j];
                        object.push("<tr>");
                        object.push("<td>" + rowsRecords.ct_TypeName + "</td>");
                        object.push("<td>" + rowsRecords.u_RealName + "</td>");
                        object.push("<td>" + rowsRecords.totalPay + "</td>");
                        object.push("<td>" + rowsRecords.c_PersonTotalCount + "</td>");
                        object.push("<td>" + rowsRecords.AvgXiaoFei + "</td>");
                        object.push("<td>" + rowsRecords.personVal + "</td>");
                        object.push("</tr>");
                    }
                    object.push("</table>");
                    object.push("</div>");
                }
                //html赋值
                var html = object.join('');
                $("#table001").html(html);
            }
        });

    });
</script>


